import book.BookList;
import user.AdministratorUser;
import user.RegularUser;
import user.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-25
 * Time: 15:34
 */
public class Main{
    public static User login(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名");
        String name = scanner.nextLine();
        System.out.println("请输入您的身份 1: 普通用户    2: 管理员用户");
        int choice = scanner.nextInt();
        if(choice == 1){
            return new RegularUser(name);
        }else{
            return new AdministratorUser(name);
        }
    }

    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();
        while(true) {
            int choice = user.menu();

            //根据选择去调用哪个对象哪个功能
            //1.哪个队象 -- user
            //2.哪个功能
            //a.确定对象有对应的功能
            user.doWork(choice, bookList);
        }
    }
}
